package com.cos.emp.services.impl;

import com.cos.emp.dao.EmpMapper;
import com.cos.emp.entity.Emp;
import com.cos.emp.services.EmpServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author: COS
 * @time: 2022/9/29 11:22
 * @description:
 */
@Service
@Transactional
public class EmpServicesImpl implements EmpServices {
    @Autowired
    private EmpMapper empMapper;

    @Override
    public Emp doLogin(String username, String password) {
        Emp emp = empMapper.getEmpByName(username);
        if (emp != null && emp.getPwd().equals(password)) {
            return emp;
        }
        return null;
    }

    @Override
    public List<Emp> getAll() {
        return empMapper.getAll();
    }
}
